<script>
function input_date(id, value) {
    var d = document.getElementById(id).value;
    var time = d.split(" ")[1];
    if (document.getElementById(id).disabled != true) {
        document.getElementById(id).value = value+" "+(time ? time : '');
    }
}
function input_time(id, time) {
    var s = document.getElementById(id).value;
    if (s == '') {
        alert("请先填写日期，再填写时间！");
        return;
    }
    var date = s.split(" ")[0];
    var datetime = date+" "+time;
    if (document.getElementById(id).disabled != true) {
        document.getElementById(id).value = datetime;
    }
}
</script>
<div class="bjui-pageContent">
    <form action="{:U(add)}" class="pageForm" data-toggle="validate">
        <input type="hidden" name="closeCurrent" value="true"  />
        <input type="hidden" name="tabid" value="{$Think.const.CONTROLLER_NAME}"  />
        <div class="container-fluid" style="overflow:hidden;">
            <div class="row">
                <div class="col-md-2"></div>
                <div class="col-md-8" style="margin-top:10px;">
                    <div class="alert alert-success">提示：1.输入所有掌握的病人资料；2.媒体来源等如果不确定就选择其他；网络客服及电话客服均可选择所有的媒体来源</div>
                </div>
                <div class="col-md-2"></div>
            </div>
            <div class="row">
                <div class="col-md-2"></div>
                <div class="col-md-8">
                    <fieldset>
                        <legend>基本信息</legend>
                        <table class="table table-condensed table-bordered table-hover" width="100%">
                            <tbody>
                                <tr>
                                    <td>
                                        <label class="control-label x85">姓名:</label>
                                        <input type="text" name="name"  value="{$data.name}" data-rule="required" size="15"/>
                                    </td>
                                    <td>
                                        <label class="control-label x85">性别:</label>
                                        <select name="sex"  data-toggle="selectpicker" >
                                            <option value="男">男</option>
                                            <option value="女">女</option>
                                        </select>
                                    </td>
                                    <td>
                                        <label class="control-label x85">年龄:</label>
                                        <input type="text" name="age" data-rule="range[0~99]" data-msg-range="请填写正确年龄" value="{$data.age}"  size="15"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <label for="province" class="control-label x85">选择地区:</label>
                                        <select name="province" data-toggle="selectpicker" data-nextselect="#city" data-refurl="/{$Think.const.CONTROLLER_NAME}/get_city/pid/{value}" data-toggle="selectpicker" data-emptytxt="--选择省市--" data-width="100">
                                            <option value="">--省市--</option>
                                            <volist name="province" id="vo">
                                                :
                                                <option value="{$vo.id}" >{$vo.name}</option>
                                            </volist>
                                        </select>
                                        <select name="city" id="city" data-toggle="selectpicker" data-nextselect="#area" data-refurl="/{$Think.const.CONTROLLER_NAME}/get_area/pid/{value}" data-emptytxt="--城市--" data-width="100">
                                            <option value="">--城市--</option>
                                        </select>
                                        <select name="area" id="area" data-toggle="selectpicker" data-emptytxt="--区县--" data-width="100">
                                            <option value="">--区县--</option>
                                        </select>
                                    </td>
                                    <td>
                                        <label  class="control-label x85">电话:</label>
                                        <input type="text" name="tel" value="{$data.tel}" data-rule="mobile" size="15"></td>
                                </tr>
                            </tbody>
                        </table>
                    </fieldset>
                    <fieldset>
                        <legend>咨询信息</legend>
                        <table class="table table-condensed table-bordered table-hover" width="100%">
                            <tbody>
                                <tr>
                                    <td>
                                        <label class="control-label x85">咨询内容:</label>
                                    </td>
                                    <td>
                                        <textarea name="textarea"  class="form-control autosize" cols="50" rows="6" data-toggle="autoheight" placeholder="咨询内容总结（不要填写QQ等联系方式，疾病信息请填入下一栏。" >{$data.content}</textarea>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <label class="control-label x85">聊天信息:</label>
                                    </td>
                                    <td>
                                        <textarea name="textarea"  class="form-control autosize" cols="50" rows="6" data-toggle="autoheight" placeholder="客服聊天记录..." >{$data.liaotian}</textarea>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </fieldset>
                    <fieldset>
                        <legend>预约信息</legend>
                        <table class="table table-condensed table-bordered table-hover" width="100%">
                            <tbody>
                                <tr>
                                    <td width="50%">
                                        <label class="control-label x85">科室:</label>
                                        <select name="department" data-toggle="selectpicker" data-nextselect="#disease" data-refurl="/{$Think.const.CONTROLLER_NAME}/get_disease/department_id/{value}" data-toggle="selectpicker" data-emptytxt="--科室--" data-width="100">
                                            <option value="">--科室--</option>
                                            <volist name="department" id="vo">
                                                <option value="{$vo.id}" >{$vo.name}</option>
                                            </volist>
                                        </select>
                                    </td>
                                    <td style="width:100px;">
                                        <label class="control-label x85">疾病类型:</label>
                                        <select name="disease" id="disease" data-toggle="selectpicker"  data-width="200" multiple>
                                            <option value="" selected>--疾病类型--</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <label class="control-label x85">媒体来源:</label>
                                        <div style="display: inline-block;">
                                            <volist name="media" id="vo">
                                                <label class="p10">
                                                    <input type="checkbox"  name="media_from" id="media" value="{$vo.name}" data-toggle="icheck" data-label="{$vo.name}"></label>
                                            </volist>

                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <label for="" class="control-label x100">自定义媒体来源:</label>
                                        <input type="text" name="media_from_diy" id="diy_media" value="" data-toggle="tags" data-url="ajaxTags.html" data-width="400" size="15" placeholder="输入关键字，回车提交"></td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <label class="control-label x85">预约时间</label>
                                        <input type="text" name="order_date" id="order_date" value="{$nowtime}" data-toggle="datepicker" data-pattern="yyyy-MM-dd HH:mm:ss" size="20" class="form-control ok" aria-required="true" style="width: 150px;"></td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <label class="control-label x85">速填日期</label>
                                        <?php
                                                foreach ($show_days as $name =>
                                        $value) {
                                                    echo '
                                        <a href="javascript:input_date(\'order_date\', \''.$value.'\')">['.$name.']</a>
                                        &nbsp;';
                                                }
                                            ?>
                                            时间:
                                        <a style="cursor:pointer" onclick="input_time('order_date','9:00:00')">[上午9点]</a>
                                        <a style="cursor:pointer" onclick="input_time('order_date','14:00:00')">[下午2点]</a>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <label for="j_custom_content" class="control-label x85">当前备注:</label>
                                        <input type="text" name="custom.createtime" id="j_custom_createtime" value="" class="form-control x200 block"  readonly="readonly"></td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <label class="control-label x85">添加备注:</label>
                                        <textarea name="textarea"   cols="50" rows="5" data-toggle="autoheight" placeholder="将添加到原有备注的后面" ></textarea>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </fieldset>
                </div>
            </div>
        </div>

    </form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li>
            <button type="button" class="btn-close">关闭</button>
        </li>
        <li>
            <button type="submit" class="btn-default">保存</button>
        </li>
    </ul>
</div>